03 May 2024
Django community aggregator: Community blog posts
Weeknotes (2024 week 18)
Weeknotes (2024 week 18)
Google Summer of Code has begun
We have a student helping out with adding async support to the Django Debug Toolbar. It's great that someone can spend some concentrated time to work on this. Tim and others have done all the necessary preparation work, I'm only helping from the sidelines so don't thank me.
Bike to Work
Two teams from my company are participating in the Bike to Work Challenge 2024. It's what I do anyway (if I'm not working from home) but maybe it helps build others some motivation to get on the bicycle once more. Public transports in the city where I live are great but I'll always take the bike when I can. I also went on my first mountain bike ride in a few months yesterday, good fun.
JSON blobs and referential integrity
The django-json-schema-editor has gained support for referencing Django models. Here's an example schema excerpt:
{
...
"articles": {
"type": "array",
"format": "table",
"title": _("articles"),
"minItems": 1,
"maxItems": 3,
"items": {
"type": "string",
"title": _("article"),
"format": "foreign_key",
"options": {
"url": "/admin/articles/article/?_popup=1&_to_field=id",
},
},
},
...
}
The ID field is stringly typed; using an integer directly wouldn't work because the empty string isn't a valid integer.
The problem with referencing models in this way is that there's no way to know if the referenced object is still around or not, or even to protect it against deletion. The bundled django-content-editor JSONPlugin
now supports automatically generating a ManyToManyField
with a through
model which protects articles from deletion as long as they are referenced from a JSONPlugin
instance. The register_reference
line creates the mentioned model with an on_delete=models.PROTECT
foreign key to articles and a post_save
handler which updates said references.
from django_json_schema_editor.plugins import JSONPluginBase, register_reference
from articles.models import Article
class JSONPlugin(JSONPluginBase, ...):
pass
register_reference(JSONPlugin, "articles", Article)
Releases since the beginning of April
- django-json-schema-editor 0.0.14: See above. Also, some styling work and a patch update to the vendorized json-editor.
- django-content-editor 6.4.6: Many small stylistic fixes. The target indicator when dragging plugins is now also shown when plugins are collapsed. It's now possible to directly drag a plugin to the end, and not just to the second to last position.
- django-prose-editor 0.3.4: Switched to the nh3 sanitizer because it's faster and because ProseMirror never emits HTML which has to be cleaned up first. Stopped generating menu items for nodes and marks which aren't in the schema. Added the possibility to reduce the functionality per editor instance. Small tweaks and fixes.
- django-tree-queries 0.19: Added support for pre-filtering the tree (much more efficient when only querying a part of the tree). Added support for adding additional fields to the CTE so that you can collect values from ancestors for other fields than the default fields too.
- FeinCMS 24.4.2: Added support for webp images. Fixed a few of the admin list filters to work with Django 5.
- django-cabinet 0.14.3: Fixed the support for the
extra_context
argument to ourchangelist_view
implementation.
03 May 2024 5:00pm GMT
Django News - New Django Ops Team Member - May 3rd 2024
News
June 2024 marks 10 incredible years of Django Girls magic! 🥳✨
Join the celebration as Django Girls turns 10 🎉 and share your experiences in our survey!
DEFNA: Board Member Update for May 2024
Velda Kiara joins the DEFNA board, and we wish Jennifer Myers a heartfelt thank you for three years of service.
Django Software Foundation
Welcome our new OPS member - Baptiste Mispelon
The DSF Board is pleased to introduce Baptiste Mispelon as a new member of the Ops team that maintains Django's infrastructure.
Updates to Django
Today 'Updates to Django' is presented by Velda Kiara from Djangonaut Space!
Last week we had 11 pull requests merged into Django by 10 different contributors - including 5 first-time contributors! Congratulations to Chris Muthig, Saurabh , James Ostrander, Tim Richardson, and Cole D for having their first commits merged into Django - welcome on board!
Django 5.0.5 got a bug fix. You can now import aprefetch_related_objects
from django.db.models
Djangonaut Space Session 2 is still open and accepting applications. Read more about it here and apply.
Django Newsletter
Wagtail CMS
Get even more organized with Wagtail 6.1
An overview of what's new in Wagtail 6.1.
How to Use ModelAdmin with Wagtail CMS v6+
As of Wagtail v6, the powerful ModelAdmin feature has been removed, but if you have extensive custom code reliant on ModelAdmin, you can use a separate package called wagtail-modeladmin
.
Sponsored Ad
Articles
Django: An admin extension to prevent state leaking between requests
A small protection to add to your Django projects.
Django from first principles
Many people don't realize you can start a Django project with a single file. This series walks through building a simple but non-trivial project by starting with a single file.
Start Charging Customers with Django and DjStripe
Use the popular Dj-Stripe
package to start collecting payments with about 10 minutes of set up.
Create a Django model index with an upper case empty string condition
James Beith shares a technique for creating a conditional database index.
How an empty S3 bucket can make your AWS bill explode
Imagine you create an empty, private AWS S3 bucket in a region of your preference. What will your AWS bill be the next morning?
Events
Meet PyCon US Keynote Speakers
This year's PyCon US keynote speakers are Jay Miller, Kate Chapman, Simon Willison, and Sumana Harihareswara.
DjangoCon Europe 2024 schedule is up
The DjangoCon Europe 2024 schedule is up and features three days of talks and workshops.
Design Articles
Adactio: Journal-My approach to HTML web components
A deep-dive into HTML web components: naming custom elements, naming attributes, the single responsibility principle, and communicating across components.
Tutorials
Building Reusable Components in Django
Build server-side UI components using django-viewcomponent.
Sponsored Link
Free Trial of Scout APM Today!
Need answers to your Django app questions fast? Avoid the hassle of talking with a sales rep and the long wait times of large support teams, and choose Scout APM. Get Django insights in less than 4 minutes with Scout APM.
Podcasts
Django Chat #162: Self-Hosted Open Source - Michael Kennedy
Michael hosts the Talk Python podcast, co-hosts Python Bytes, and runs courses at Talk Python Training. We discuss his recent shift to mainly self-hosted open-source options for everything from marketing emails to analytics and more.
Django News Jobs
Principal Backend Software Engineer at Monitaur 🆕
Senior Full Stack Software Engineer at Monitaur 🆕
Senior AI Engineer (f/m/d) at 1&1
Michigan Online Software Engineer at University of Michigan
Web developer at der Freitag Mediengesellschaft
Backend Software Architect, EarthRanger (Contract Opportunity) at AI2
Senior Software Engineer (backend) - IASO at Bluesquare
Django Newsletter
Projects
rails-inspire-django/django-viewcomponent
Build reusable components in Django, inspired by Rails ViewComponent.
If you have been looking for a way to build reusable components in Django, this is worth checking out.
edoburu/django-any-urlfield
An improved URL selector to choose between internal models and external URLs.
pydanny/dj-notebook
Django + shell_plus + Jupyter notebooks made easy.
This RSS feed is published on https://django-news.com/. You can also subscribe via email.
03 May 2024 3:00pm GMT
Building Reusable Components in Django
This tutorial looks at how to build server-side UI components in Django.
03 May 2024 3:28am GMT